set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")

add_library(sekai SHARED 
	src/audioio.cpp
	src/midi.cpp
	src/common.cpp
	src/hzosc.cpp
	src/epr.cpp
	src/OLABuffer.cpp
	src/VoiceSampler.cpp
	src/JSONReader.cpp
	src/track.cpp
    src/PitchModel.cpp
)

set(HEADERS 
	src/sekai/midi.h
	src/sekai/mfcc.h
	src/sekai/SekaiContext.h
	src/sekai/VVDReader.h
	src/sekai/OLABuffer.h
	src/sekai/VoiceSampler.h
	src/sekai/vvd.h
	src/sekai/common.h
	src/sekai/hzosc.h
	src/sekai/epr.h
	src/sekai/track.h
    src/sekai/PitchModel.h
    src/sekai/EventList.h
)

ADD_DEFINITIONS(-std=c++11 -g)

set(SEKAI_VERSION_MAJOR 0)
set(SEKAI_VERSION_MINOR 4)
set(SEKAI_VERSION_PATCH 0)
set(SEKAI_VERSION_STRING ${SEKAI_VERSION_MAJOR}.${SEKAI_VERSION_MINOR}.${SEKAI_VERSION_PATCH})
set_target_properties(sekai PROPERTIES VERSION ${SEKAI_VERSION_STRING}
                                           SOVERSION ${SEKAI_VERSION_MAJOR})
                                           
target_link_libraries(sekai fftw3 jsoncpp boost_system boost_filesystem)
                                           
include_directories(src)

#add_definitions ("-Wall")

install(FILES ${HEADERS} DESTINATION include/sekai)

EXECUTE_PROCESS(COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH OUTPUT_VARIABLE
  CMAKE_ARCH_TRIPLET OUTPUT_STRIP_TRAILING_WHITESPACE)

add_executable(vosamp_test examples/vosamp_test/vosamp_test.cpp)
target_link_libraries(vosamp_test sekai sndfile gsl gslcblas)

add_executable(eventlist_test examples/eventlist_test/eventlist_test.cpp)
target_link_libraries(eventlist_test sekai sndfile gsl gslcblas)

add_executable(realtime_demo examples/realtime_demo/main.cpp examples/realtime_demo/jack.cpp examples/realtime_demo/synth.cpp)
target_link_libraries(realtime_demo sekai sndfile jack gsl gslcblas pthread)

install(TARGETS sekai
        RUNTIME DESTINATION bin
        LIBRARY DESTINATION lib/${CMAKE_ARCH_TRIPLET}
)
